# 封装
# class Phone:  # 私有化：在变量或方法名之前加两个__
#     __current_voltage = 0.5
#
#     def __keep_single_core(self):
#         print("让CPU以单核模式运行")
#
#     def call_by_5G(self):
#         if self.__current_voltage >= 1:
#             print("5G通话已开启")
#         else:
#             self.__keep_single_core()
#             print("电量不足, 无法使用5G通话, 并已设置为单核模式运行省电.")
#
#
# phone = Phone()
# phone.call_by_5G()
# 继承
class Phone:
    IMEI = None  # 序列号
    producer = "ITCAST"  # 厂商

    def call_by_4G(self):
        print("4G通话")


class Phone2024(Phone):
    face_id = "10001"  # 面部识别id

    def call_by_5G(self):
        print("2024新功能：5G通话")


phone2024 = Phone2024()
print(phone2024.producer)
phone2024.call_by_4G()
phone2024.call_by_5G()


# 演示多继承
class NFCReader:
    nfc_type = "第五代"
    producer = "HM"

    def read_card(self):
        print("NFC读卡")

    def write_card(self):
        print("NFC读卡")


class RemoteControl:
    rc_type = "红外遥控"

    def control(self):
        print("红外遥控开始了")


class MyPhone(Phone, NFCReader, RemoteControl):
    pass


phone = MyPhone()
phone.call_by_4G()
phone.read_card()
phone.write_card()
phone.control()
print(phone.producer)

